package at.com.vn.chess.dao;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

import at.com.vn.chess.util.HibernateUtil;

public class BaseDao {

	/** Getting the Session Factory and session */
	private SessionFactory session = null;
	private Session sess = null;
	Transaction tx = null;

	public BaseDao() {
		session = HibernateUtil.getSessionFactory();
		sess = session.getCurrentSession();
	}

	public void beginTrans() {
		/** Starting the Transaction */
		tx = sess.beginTransaction();
	}

	public void commitTrans() {
		/** Commiting the changes */
		tx.commit();
	}

	public void closeTrans() {
		/** Closing Session */
		session.close();
	}

	public Session getSess() {
		return sess;
	}
	
	
}